<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <title>角色分配</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/static/bui/css/bs3/dpl.css" rel="stylesheet" type="text/css"/>
    <link href="/static/bui/css/bs3/bui.css" rel="stylesheet" type="text/css"/>
</head>
<body>

<div class="container">
    <form id="J_Form" class="form-horizontal" action="/user/role/${id}" method="post">
        <h3>角色分配</h3>
        <c:forEach items="${roleList }" var="role">

            <div class="row">
                <div class="control-group span12">
                    <div class="controls">
                        <c:choose>
                            <c:when test="${fn:contains(roleIds,role.id)}">
                                <input type="checkbox" name="roleIds" value="${role.id}" checked>${role.description}
                            </c:when>
                            <c:otherwise>
                                <input type="checkbox" name="roleIds" value="${role.id}">${role.description}
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
            </div>

        </c:forEach>


        <div class="row">
            <div class="form-actions offset3">
                <button type="submit" class="button button-primary">提交</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="/static/bui/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/static/bui/js/bui.js"></script>
<script type="text/javascript">
    BUI.use('bui/form', function (Form) {
        new Form.Form({
            srcNode: '#J_Form'
        }).render();
    });
</script>
</body>
</html>
